home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / isurfaceplugin.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  6.7 KB  |  195 lines

  1. //-----------------------------------------------------------------------------
  2. //
  3. // $LogFile$
  4. // $Revision: 1.1.1.4.2.1 $
  5. // $Author: ttimo $
  6. // $Date: 2000/02/13 17:25:04 $
  7. // $Log: isurfaceplugin.h,v $
  8. // Revision 1.1.1.4.2.1  2000/02/13 17:25:04  ttimo
  9. // started cleanup
  10. //
  11. // Revision 1.1.1.4  2000/01/18 00:17:13  ttimo
  12. // merging in for RC
  13. //
  14. // Revision 1.3  2000/01/17 23:53:44  TBesset
  15. // ready for merge in sourceforge (RC candidate)
  16. //
  17. // Revision 1.2  2000/01/07 16:40:13  TBesset
  18. // merged from BSP frontend
  19. //
  20. // Revision 1.1.1.3  1999/12/29 18:31:28  TBesset
  21. // Q3Radiant public version
  22. //
  23. // Revision 1.1.1.1.2.1  1999/12/29 21:39:45  TBesset
  24. // updated to update3 from Robert
  25. //
  26. // Revision 1.1.1.3  1999/12/29 18:31:28  TBesset
  27. // Q3Radiant public version
  28. // Revision 1.1.1.3  1999/12/29 18:31:28  TBesset
  29. // Q3Radiant public version
  30. //
  31. // Revision 1.2  1999/11/22 17:46:48  Timo & Christine
  32. // merged EARadiant into the main tree
  33. // bug fixes for Q3Plugin / EAPlugin
  34. // export for Robert
  35. //
  36. // Revision 1.1.2.4  1999/11/20 12:13:02  Timo & Christine
  37. // first release to Wolfen and Spog
  38. // with TexTool and DeQbsp3 plugin
  39. //
  40. // Revision 1.1.2.3  1999/11/16 14:23:13  Timo & Christine
  41. // merged 173 into Q3Radiant, EARadiant branch
  42. // see Timo\changelog.txt for merge log
  43. //
  44. // Revision 1.1.2.2  1999/11/14 16:26:15  Timo & Christine
  45. // first beta of the ritualmap surface plugin
  46. //
  47. // Revision 1.1.2.1  1999/10/08 16:28:15  Timo & Christine
  48. // started plugin extensions for EA features support in Q3Radiant
  49. // MEAN files plugin, and Surface Properties plugin
  50. //
  51. //
  52. // DESCRIPTION:
  53. // 
  54. //
  55.  
  56. #ifndef __ISURFACEPLUGIN_H_
  57. #define __ISURFACEPLUGIN_H_
  58.  
  59. #ifndef Q3RADIANT
  60.  
  61. // this is plugin included, define miptex_t
  62. //++timo FIXME: move definition into qertypes.h ? or assume plugin knows ?
  63. #define    MIPLEVELS    4
  64. typedef struct miptex_s
  65. {
  66.     char        name[32];
  67.     unsigned    width, height;
  68.     unsigned    offsets[MIPLEVELS];        // four mip maps stored
  69.     char        animname[32];            // next frame in animation chain
  70.     int            flags;
  71.     int            contents;
  72.     int            value;
  73. } miptex_t;
  74.  
  75. #endif
  76.  
  77. /*
  78. // there's a void* in each qtexture_t, must be casted to a IPluginQTexture*
  79. class IPluginQTexture
  80. {
  81. public:
  82.     // Increment the number of references to this object
  83.     virtual void IncRef () = 0;
  84.     // Decrement the reference count
  85.     virtual void DecRef () = 0;
  86.     // Init for a miptex_t
  87.     virtual void InitForMiptex( miptex_t* ) = 0;
  88.     // set default texdef
  89.     virtual void SetDefaultTexdef() = 0;
  90. };
  91.  
  92. // use this macro
  93. #define GETPLUGINQTEXTURE(pQTexture) (static_cast<IPluginQTexture *>(pQTexture->pData))
  94. */
  95.  
  96. // there's a void* in each qtexture_t, must be casted to a IPluginTexdef*
  97. // there's a void* in each face_t, must be casted to a IPluginTexdef*
  98. // NOTE: IPluginTexdef stores a pointer to the qtexture_t or face_t it's stored in
  99. // members of IPluginTexdef often access the qtexture_t or face_t they are connected to
  100.  
  101. // Write texdef needs a function pointer, because Radiant either writes into a FILE or a CMemFile
  102. typedef void (WINAPI* PFN_QERAPP_MAPPRINTF) ( char *text, ... );
  103.  
  104. class IPluginTexdef
  105. {
  106. public:
  107.     // Increment the number of references to this object
  108.     virtual void IncRef () = 0;
  109.     // Decrement the reference count
  110.     virtual void DecRef () = 0;
  111.     // Build a copy of this one, sets refCount to 1
  112.     virtual IPluginTexdef* Copy() = 0;
  113.     // refers to a face_t -----------------------
  114.     // Parse texdef
  115.     virtual void ParseTexdef () = 0;
  116.     // Write texdef
  117.     virtual void WriteTexdef (PFN_QERAPP_MAPPRINTF MapPrintf) = 0;
  118.     // hook to a face
  119.     virtual void Hook( face_t* ) = 0;
  120.     // ------------------------------------------
  121.     // refers to a qtexture_t -------------------
  122.     // Init for a miptex_t
  123.     //++timo NOTE: miptex_t is used only for .WAL format .. a bit outdated
  124.     virtual void InitForMiptex( miptex_t* ) = 0;
  125.     // set default texdef
  126.     virtual void SetDefaultTexdef() = 0;
  127.     // ------------------------------------------
  128.     // refers to a patchMesh_t ------------------
  129.     virtual void ParsePatchTexdef () = 0;
  130.     // write texdef for a patch
  131.     virtual void WritePatchTexdef (PFN_QERAPP_MAPPRINTF MapPrintf) = 0;
  132.     // hook to a patch
  133.     virtual void Hook( patchMesh_t* ) = 0;
  134.     // ------------------------------------------
  135. };
  136.  
  137. // use this macro
  138. #define GETPLUGINTEXDEF(pFace) (static_cast<IPluginTexdef *>(pFace->pData))
  139.  
  140. // this one is used by Radiant to access the surface plugin
  141.  
  142. // {7DA59920-93D8-11d3-8EF3-0000E8E8657B}
  143. static const GUID QERPlugSurfaceTable_GUID = 
  144. { 0x7da59920, 0x93d8, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
  145.  
  146. typedef void (WINAPI* PFN_QERPLUG_DOSURFACE)            ();
  147. typedef bool (WINAPI* PFN_QERPLUG_BYEBYESURFACEDIALOG)    ();
  148. typedef void (WINAPI* PFN_QERPLUG_UPDATESURFACEDIALOG)    ();
  149. // allocates a new IPluginTexdef, linked to a face_t, refCount is set to 1
  150. typedef IPluginTexdef* (WINAPI* PFN_QERPLUG_TEXDEFALLOC)    ( face_t* );
  151. // allocates a new IPluginTexdef, linked to a qtexture_t, refCount is set to 1
  152. typedef IPluginTexdef* (WINAPI* PFN_QERPLUG_QTEXTUREALLOC)    ( qtexture_t* );
  153. // allocates a new IPluginTexdef, linked to a patchMesh_t, refCount is set to 1
  154. typedef IPluginTexdef* (WINAPI* PFN_QERPLUG_PATCHALLOC)        ( patchMesh_t* );
  155.  
  156. struct _QERPlugSurfaceTable
  157. {
  158.     int m_nSize;
  159.     PFN_QERPLUG_BYEBYESURFACEDIALOG        m_pfnByeByeSurfaceDialog;
  160.     PFN_QERPLUG_DOSURFACE                m_pfnDoSurface;
  161.     PFN_QERPLUG_UPDATESURFACEDIALOG        m_pfnUpdateSurfaceDialog;
  162.     PFN_QERPLUG_TEXDEFALLOC                m_pfnTexdefAlloc;
  163.     PFN_QERPLUG_QTEXTUREALLOC            m_pfnQTextureAlloc;
  164.     PFN_QERPLUG_PATCHALLOC                m_pfnPatchAlloc;
  165. };
  166.  
  167. // this one is used by the plugin to access some Radiant stuff
  168.  
  169. // {42BAE4C0-9787-11d3-8EF3-0000E8E8657B}
  170. static const GUID QERAppSurfaceTable_GUID = 
  171. { 0x42bae4c0, 0x9787, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
  172.  
  173. typedef bool (WINAPI* PFN_PATCHESSELECTED)    ();
  174. // retrieve g_qeglobals.texturewin_t
  175. //++timo FIXME: this should move in a dedicated table for all g_qeglobals stuff
  176. typedef texturewin_t* (WINAPI* PFN_QEGLOBALSTEXTUREWIN) ();
  177. // look for the first selected patch mesh
  178. //++timo FIXME: this is a convenient func since there's no way to scan patches ( yet )
  179. typedef patchMesh_t* (WINAPI* PFN_GETSELECTEDPATCH) ();
  180. typedef void (WINAPI* PFN_PATCHREBUILD) (patchMesh_t *p);
  181. //++timo FIXME: this one in particular is a hack
  182. typedef void (WINAPI* PFN_GETTWOSELECTEDPATCH) (patchMesh_t **p1, patchMesh_t **p2);
  183.  
  184. struct _QERAppSurfaceTable
  185. {
  186.     int m_nSize;
  187.     PFN_PATCHESSELECTED        m_pfnOnlyPatchesSelected;
  188.     PFN_PATCHESSELECTED        m_pfnAnyPatchesSelected;
  189.     PFN_QEGLOBALSTEXTUREWIN    m_pfnQeglobalsTexturewin;
  190.     PFN_GETSELECTEDPATCH    m_pfnGetSelectedPatch;
  191.     PFN_PATCHREBUILD        m_pfnPatchRebuild;
  192.     PFN_GETTWOSELECTEDPATCH    m_pfnGetTwoSelectedPatch;
  193. };
  194.  
  195. #endif